import { requestClient } from '#/api/request';

export interface PageFetchParams {
  page: number;
  limit: number;

  [key: string]: any;
}

/**
 * 分页查询角色列表
 * @param params
 */
export async function getAdminPageApi(params?: PageFetchParams) {
  return requestClient.get<string[]>(`/admin`, { params });
}

/**
 * 获取角色详情
 * @param id
 */
export async function getAdminInfoApi(id: string) {
  return requestClient.get(`/admin/${id}`);
}

/**
 * 添加角色
 * @param data
 */
export async function storeAdminApi(data: any) {
  return requestClient.post(`/admin`, data);
}

/**
 * 编辑角色
 * @param id
 * @param data
 */
export async function updateAdminApi(id: string, data: any) {
  return requestClient.put(`/admin/${id}`, data);
}

/**
 * 删除角色
 * @param id
 */
export async function deleteAdminApi(id: string) {
  return requestClient.delete(`/admin/${id}`);
}

/**
 * 修改状态
 * @param id
 */
export async function setAdminStatusApi(id: string) {
  return requestClient.put(`/admin/${id}/setStatus`);
}

/**
 * 批量上传
 * @param id
 */
export async function importStoreAdminApi(data: any) {
  return requestClient.post(`/admin/import`, data);
}
